/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.config.controller;

import com.icinfo.cloud.common.core.Validator.BaseGroup;
import com.icinfo.cloud.common.core.page.PageResponse;
import com.icinfo.cloud.provider.punish.config.dto.ConfigCaseApprovalCenterLineDto;
import com.icinfo.cloud.provider.punish.config.dto.ConfigCaseApprovalCenterLinePageRequest;
import com.icinfo.cloud.provider.punish.config.service.IConfigCaseApprovalCenterLineService;
import com.icinfo.cloud.provider.punish.config.vo.ConfigCaseApprovalCenterLineVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 描述: 联合法制审核配置参数表-修改审批条线 config_case_approval_center_line 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年04月02日
 */
@RestController
@RequestMapping("/config/CaseApprovalCenterLine")
public class ConfigCaseApprovalCenterLineController extends BaseController {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(ConfigCaseApprovalCenterLineController.class);

    @Autowired
    private IConfigCaseApprovalCenterLineService configCaseApprovalCenterLineService;

    /**
     * 【V1.1.0】描述：联合法制审核参数配置分页列表
     * @author liyafeng
     * @date 2022/4/2
      * @param request
     * @return {@link Result< PageResponse< ConfigCaseApprovalCenterLineVo>>}
     */
    @PostMapping("/list")
    public Result<PageResponse<ConfigCaseApprovalCenterLineVo>> list(@RequestBody @Validated(BaseGroup.Query.class) ConfigCaseApprovalCenterLinePageRequest request) {
        List<ConfigCaseApprovalCenterLineVo> caseApprovalCenterLineVos=configCaseApprovalCenterLineService.getConfigCaseApprovalCenterLineVoList(request);
        return Result.success("查询成功",new PageResponse<>(caseApprovalCenterLineVos));
    }
    /**
     * 【V1.1.0】描述：修改审批条线
     * @author liyafeng
     * @date 2022/4/2
      * @param configCaseApprovalCenterLineDto
     * @return {@link Result< String>}
     */
    @PostMapping("/edit")
    public Result<String>  edit(@RequestBody @Validated(BaseGroup.Update.class) ConfigCaseApprovalCenterLineDto configCaseApprovalCenterLineDto) {
        int num=configCaseApprovalCenterLineService.editConfigCaseApprovalCenterLineDto(configCaseApprovalCenterLineDto);
        if(num>0){
            return Result.success("修改成功");
        }else {
            return Result.error("修改失败");
        }
    }
}